{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "source": [
    "This simple notebook can be used to test that PyStan has been succesfully installed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "autoscroll": false,
    "collapsed": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [],
   "source": [
    "import pystan\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "autoscroll": false,
    "collapsed": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_c119d6069f0316b80eefa9c12c3ce343 NOW.\n"
     ]
    }
   ],
   "source": [
    "fit = pystan.stan(model_code=\"parameters {real theta;} model {theta ~ normal(0,1);}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "autoscroll": false,
    "collapsed": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAADylJREFUeJzt3X+s3Xddx/HnyzmHAYyQXmrpD+9IqkmHUMxNxcw/JlOo\njFAgcemiOONi+WP8SpaYdUsEY5rMIKCJgiluYcbJaALLFpiOMZcsJMLo5oC1ZdqwzrXp1iIYRkxm\n2r39434LZ5f745x7zuk599PnI2nu9/v5fr/nvNf1vu7nfr6f7+ekqpAkteunJl2AJGm8DHpJapxB\nL0mNM+glqXEGvSQ1zqCXpMYZ9JLUOINekhpn0EtS43560gUArFu3rmZnZyddhiStKY888sh3q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3e3H3Z+q+\nl5NsAq4C/n61rzF1QZ9kF3Ciqr4x6VqWk2RfkqeB32M6e/S9/gj450kXsUYstnzHVAXUWpNkFngD\n8LXJVvKTuiGRx4BTwP1VNXU1An/FfMf3hdW+wESWQEjyZeAXFjl0M3AT88M2E7VcjVV1d1XdDNyc\nZC/wXuBD57VAVq6xO+dm5n+NvuN81nZOPzWqXUleBnwO+OCC34SnQlWdBbZ397DuSvLaqpqa+x5J\n3gacqqpHklyx2teZSNBX1W8t1p7kV4BLgW8kgfnhhkeT7KiqZ85jiUvWuIg7mH9e4LwH/Uo1JvlD\n4G3AlTWhebQD/D1OixWX71B/klzMfMjfUVWfn3Q9y6mq/0nyIPP3PaYm6IHLgbcneSvwEuDnkvxj\nVf3+IC8yVUM3VfWtqnpVVc1W1Szzvzb/6vkO+ZUk2dqzuwv49qRqWUqSncz/uvf2qvrfSdezhrh8\nxwhkvqd2K3Ckqj426XoWk2Tm3Gy0JD8L/DZT9r1cVXuralOXh7uBfx005GHKgn4NuSXJ40m+yfww\n09RNHQP+Bng5cH83DfTvJl3QQknemeQ48OvAF5PcN+mauhvY55bvOAIcmMblO5J8Bvg34JeTHE9y\n3aRrWuBy4N3Am7p/f491vdJpsgF4sPs+/jrzY/Srmr447XwyVpIaZ49ekhpn0EtS4wx6SWqcQS9J\njTPoJalxBr0kNc6gl6TGGfSS1Lj/Bzt5E/TEo6W9AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f84298f55c0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "samples = fit.extract(permuted=True)\n",
    "plt.hist(samples['theta'], 50);"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  },
  "name": "PyStan_test_installation.ipynb"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
